
import calendar


def makecalendar(month,year,events):
    if month < 1 or month > 12:
        raise "illegal month"
        
    monthname = calendar.month_name[month]
    print '<div class="calendar">'
    print '  <h1>%s, %s</h1>' % (monthname,str(year))
    print '  <table class="calendar">'
    y = 0
    for row in calendar.monthcalendar(year,month):
        x = 0
        print '    <tr>',
        for cell in row:
            if cell != 0:
                if cell in events:
                    print '<td class="active"><a class="day" href="" title="All events for %s %02d">%02d</a><br>' % (monthname,cell,cell),
                    print '<a href="">some random event</a><br>'
                    print '<a href="">another event</a><br>'
                    print '</td>'
                else:
                    print '<td>%02d</td>' % (cell),
            else:
                print '<td class="null">&nbsp;</td>',
            x = x + 50
        y = y + 50
        print '</tr>'
    print '  </table>'
    print '</div>'
    
makecalendar(1,2004,[])#[3,4,17])
